package data_structure;

public class leetcode_0083 {
    public ListNode deleteDuplicates(ListNode head) {
        if(head==null) return head;
        ListNode p=head;
        ListNode q=head.next;
        while(q!=null){
            if(p.val==q.val){
                p.next=q.next;
                q=p.next;
            }

            else{
                p=p.next;
                q=q.next;
            }
        }
        return head;
    }
}
